
#include "MY_INC/PHY/PHY_IIRFilter.h"

static inline void Coeff2P2Z_Reset_Inline(Coeff_2P2Z *_2P2Z);
void Coeff2P2Z_Init(Coeff_2P2Z *_2P2Z, float Coeff_B0, float Coeff_B1, float Coeff_B2, float Coeff_A1, float Coeff_A2)
{
    if (_2P2Z == NULL)
        return; // 检查指针是否为 NULL
    _2P2Z->Coeff_B0 = Coeff_B0;
    _2P2Z->Coeff_B1 = Coeff_B1;
    _2P2Z->Coeff_B2 = Coeff_B2;
    _2P2Z->Coeff_A1 = Coeff_A1;
    _2P2Z->Coeff_A2 = Coeff_A2;

    Coeff2P2Z_Reset_Inline(_2P2Z);
}
void Coeff2P2Z_Reset(Coeff_2P2Z *_2P2Z)
{
    if (_2P2Z == NULL)
        return;                    // 检查指针是否为 NULL
    Coeff2P2Z_Reset_Inline(_2P2Z); // 重置状态变量
}
static inline void Coeff2P2Z_Reset_Inline(Coeff_2P2Z *_2P2Z)
{
    _2P2Z->Xn_1 = 0.0f; // 输入信号Xn-1
    _2P2Z->Xn_2 = 0.0f; // 输入信号Xn-2
    _2P2Z->Yn_1 = 0.0f; // 输出信号Yn-1
    _2P2Z->Yn_2 = 0.0f; // 输出信号Yn-2
}

static inline void Coeff1P0Z_Reset_Inline(Coeff_1P0Z *_1P0Z);
void               Coeff1P0Z_Init(Coeff_1P0Z *_1P0Z, float Coeff_B0, float Coeff_B1, float Coeff_A1)
{
    _1P0Z->Coeff_B0 = Coeff_B0;
    _1P0Z->Coeff_B1 = Coeff_B1;
    _1P0Z->Coeff_A1 = Coeff_A1;
    Coeff1P0Z_Reset_Inline(_1P0Z);
}

void Coeff1P0Z_Reset(Coeff_1P0Z *_1P0Z)
{
    _1P0Z->Xn_1 = 0.0f; // 输入信号Xn-1
    _1P0Z->Yn_1 = 0.0f; // 输出信号Yn-1
}
static inline void Coeff1P0Z_Reset_Inline(Coeff_1P0Z *_1P0Z)
{
    _1P0Z->Xn_1 = 0.0f; // 输入信号Xn-1
    _1P0Z->Yn_1 = 0.0f; // 输出信号Yn-1
}